﻿using Airborne.ScrumPoker.Module.Host.Controllers;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Unity;

namespace Airborne.ScrumPoker.Module.Host
{
    public class HostModule : IModule
    {
        #region Constructor
        public HostModule(IUnityContainer container)
        {
            Container = container;
        }
        #endregion

        #region Properties
        private IUnityContainer Container { get;  set; }

        #endregion

        #region IModule Members

        public void Initialize()
        {
            RegisterComponents();
            Container.Resolve<IHostController>().Run();
        }

        #endregion

        #region Methods
        private void RegisterComponents()
        {
            Container.RegisterType<IHostController, HostController>(new ExternallyControlledLifetimeManager());
        }
        #endregion
    }
}
